﻿using ST.WX.Common.Enums;
using System.Collections.Generic;

namespace ST.WX.Common
{
	/// <summary>
	/// 应用管理器接口
	/// </summary>
	public interface IWXAppManager
	{
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		Dictionary<string, WXAppConfig> GetApps();

		/// <summary>
		/// 根据当前请求的域名获取第一个应用配置信息
		/// </summary>
		/// <returns></returns>
		WXAppConfig GetAppDefault(WXAppType type = WXAppType.MP);

		/// <summary>
		/// 根据AppID获取应用配置信息
		/// </summary>
		/// <param name="appID"></param>
		/// <returns></returns>
		WXAppConfig GetAppByID(string appID);

		/// <summary>
		/// 根据域名获取第一个应用配置信息（不限类型）
		/// </summary>
		/// <param name="domain"></param>
		/// <returns></returns>
		WXAppConfig GetAppByDomain(string domain);

		/// <summary>
		/// 根据域名获取应用配置信息
		/// </summary>
		/// <param name="domain"></param>
		/// <param name="type"></param>
		/// <returns></returns>
		WXAppConfig GetAppByDomain(string domain, WXAppType type);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="appConfig"></param>
		bool AddApp(WXAppConfig appConfig, bool allowReregister = true);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="appConfig"></param>
		bool RemoveApp(WXAppConfig appConfig);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="appID"></param>
		bool RemoveApp(string appID);
	}
}
